package com.tao.product.service.impl;

import com.tao.product.bean.Product;
import com.tao.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @author xujingtao
 */
@Service
@Slf4j
public class ProductServiceImpl implements ProductService {
    @Override
    public Product getProduct(Long productId) {
        Product product = new Product();
        product.setId(productId);
        product.setPrice(new BigDecimal(99));
        product.setProductName("苹果-" + productId);
        product.setNum(2);
        log.info("产品信息为：{}", product);

        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            throw  new RuntimeException(e);
        }

        return product;
    }
}
